package cn.iocoder.yudao.module.blog.dal.mysql.postlike;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.blog.dal.dataobject.postlike.BlogPostLikeDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.blog.controller.admin.postlike.vo.*;

/**
 * 帖子点赞 Mapper
 *
 * @author 曹建伟
 */
@Mapper
public interface BlogPostLikeMapper extends BaseMapperX<BlogPostLikeDO> {

    default PageResult<BlogPostLikeDO> selectPage(BlogPostLikePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlogPostLikeDO>()
                .eqIfPresent(BlogPostLikeDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(BlogPostLikeDO::getPostId, reqVO.getPostId())
                .betweenIfPresent(BlogPostLikeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogPostLikeDO::getId));
    }

    default List<BlogPostLikeDO> selectList(BlogPostLikeExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BlogPostLikeDO>()
                .eqIfPresent(BlogPostLikeDO::getMemberId, reqVO.getMemberId())
                .eqIfPresent(BlogPostLikeDO::getPostId, reqVO.getPostId())
                .betweenIfPresent(BlogPostLikeDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BlogPostLikeDO::getId));
    }

}
